package cn.ztuo.bitrade.entity;

import cn.ztuo.bitrade.constant.BooleanEnum;
import lombok.Data;

import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * @Description
 * @Author  Hunter
 * @Date 2020-03-05
 * @Description 合约持有仓位
 */

@Data
@Entity
@Table ( name ="contract_position" )
public class ContractPosition implements Serializable {

	private static final long serialVersionUID =  1L;

	/**
	 * 订单ID
	 */
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Long id;
	/**
	 * 用户ID
	 */
   	@Column(name = "member_id" )
	private Long memberId;
	/**
	 * 交易币种
	 */
   	@Column(name = "symbol" )
	private String symbol;
	/**
	 * 总仓(仓位价值累加)
	 */
   	@Column(name = "position_total_value" )
	private BigDecimal positionTotalValue ;
	/**
	 * 总仓(合约数量总数)
	 */
   	@Column(name = "contract_total_num" )
	private Integer contractTotalNum;
	/**
	 * 可用(可用合约数量)
	 */
   	@Column(name = "contract_occupy_num" )
	private Integer contractOccupyNum;
	/**
	 * 持仓均价
	 */
   	@Column(name = "position_avg_price" )
	private BigDecimal positionAvgPrice ;
	/**
	 * 可用保证金
	 */
   	@Column(name = "useable_bond" )
	private BigDecimal useableBond ;
	/**
	 * 占用保证金
	 */
   	@Column(name = "holding_bond" )
	private BigDecimal holdingBond ;
	/**
	 * 未实现盈亏(金额)
	 */
   	@Column(name = "blur_gain_loss" )
	private BigDecimal blurGainLloss ;
	/**
	 * 实现盈亏(金额)
	 */
   	@Column(name = "deal_gain_loss" )
	private BigDecimal dealGainLoss ;
	/**
	 * 收益率(百分比)
	 */
   	@Column(name = "gainLossRate" )
	private BigDecimal gainLossRate ;
	/**
	 * 预估强平价格
	 */
   	@Column(name = "predict_force_price" )
	private BigDecimal predictForcePrice ;
	/**
	 * 维持保证金率
	 */
   	@Column(name = "maintain" )
	private BigDecimal maintain ;
	/**
	 * 止盈(合约数量)
	 */
   	@Column(name = "stop_gain_num" )
	private Integer stopGainNum ;
	/**
	 * 止损(合约数量)
	 */
   	@Column(name = "stop_loss_num" )
	private Integer stopLossNum;
	/**
	 * 创建时间
	 */
   	@Column(name = "create_time" )
	private Date createTime;
	/**
	 * 修改时间
	 */
   	@Column(name = "update_time" )
	private Date updateTime;
	/**
	 * 状态
	 */
   	@Column(name = "status" )
	private Integer status =0;
	/**
	 * 状态
	 */
   	@Column(name = "is_lock" )
	private BooleanEnum isLock=BooleanEnum.IS_FALSE;
	/**
	 * 仓位类型
	 */
   	@Column(name = "contract_position_type" )
	private ContractOrderPositionType positionType;

	/**
	 * 当前杠杆
	 */
   	@Column(name = "current_multiple")
	private String currentMultiple;

   	@Transient
	private String baseCoin;

}
